<?php
namespace Admin\Controller;
use Common\Controller\CommonController;
class SliderController extends CommonController {
	///显示全部幻灯列表
    public function index(){
        $model = D('Slider'); 
        $data = $model->select();
        /*echo '<pre>';
        print_r( $data);
        echo '</pre>';*/
    }
	//显示留言详情
    public function lst_main($id=''){

 		$id = trim(I('id'));
     	$model = D('Slider'); 
     	$data = $model->find($id);
		if(!$data){
			echo'数据不存在或已被删除';
			exit;
		}
        echo '<pre>';
        print_r( $data);
        echo '</pre>';
        $this->assign('silder', $data);
       // $this->display();
    }
    //添加留言-显示表单
     public function edit($id=''){
     		$id = trim(I('id'));
	     	$model = D('Slider'); 
			$data = $model->find($id);
		
	        if($model->where('id=$id')->save($data)){// 根据条件更新记录
	        	echo "修改成功";
	        }else{
	        	echo "修改失败";
	        }
    }

    //添加留言-显示表单
     public function del($id=''){
     		$id = trim(I('id'));
	     	$model = D('Slider'); 

	        if($model->delete($id)){
	        	echo "删除成功";
	        }else{
	        	echo "删除失败";
	        }
    }


}
